using System.Collections;
using System.Collections.Generic;
using TowerDefence_Study;
using UnityEngine;
using UnityEngine.UI;

namespace TowerDefence
{
    public class UIBattleResult : UILayer
    {
        private Text mResultText;
        
      
        public void InitData(bool isWin)
        {
            if (isWin)
            {
                mResultText.text = "防守成功";
                AudioManager.PlaySound("battle_success");
               
            }
            else
            {
                mResultText.text = "防守失败";
                AudioManager.PlaySound("battle_fail");
            }
        }
        public override void OnNodeLoad()
        {
            
        }

        public override void OnEnter()
        {
            
        }

        public override void OnExit()
        {
            
        }

        protected override void OnButtonClick(string name, GameObject obj)
        {
            switch (name)
            {
                case "BackBtn":
                   BattleManager.Clear();
                    UIManager.ExitAllUI();
                    AudioManager.PlayBg("music_login");
                    UIManager.EnterUI<UI_Main>();
                    break;
            }
        }

        protected override void OnNodeAsset(string name, GameObject obj)
        {
            switch (name)
            {
                case "ResultTex":
                    mResultText=obj.GetComponent<Text>();
                    break;
            }
        }
    }
}

